package com.qianli.user.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/3/15
 * Time: 下午9:41
 */
public enum QuotaEnum {
    NOT_EVALUATED(0, "not_evaluated", "尚未评估额度"),
    CREDIT_SCORE_LACK(1, "credit_score_lack", "评分信用不足"),
    NEED_WAIT_MONTH(2, "need_wait_month", "芝麻分和同盾数据不良,提示下个月再来"),
    PASS(3, "pass", "通过"),
    EXCEPTION(4, "exception", "exception");

    private Integer type;
    private String desc;
    private String name;

    QuotaEnum(Integer type, String desc, String name) {
        this.type = type;
        this.desc = desc;
        this.name = name;
    }
    
    public Integer getType() {
        return type;
    }

    public QuotaEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public QuotaEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public String getName() {
        return name;
    }

    public QuotaEnum setName(String name) {
        this.name = name;
        return this;
    }

    public static QuotaEnum getEnumByType(Integer type) {
        QuotaEnum userQuotaEnum = null;
        for (QuotaEnum u : QuotaEnum.values()) {
            if (u.getType().equals(type)) {
                userQuotaEnum = u;
            }
        }

        return userQuotaEnum;
    }
}
